//
//  AppDelegate.m
//  ShareManagerDemo
//
//  Created by 曹敬贺 on 16/9/14.
//  Copyright © 2016年 北京无限点乐科技有限公司. All rights reserved.
//

#import "AppDelegate.h"
#import "ShareManager.h"

#pragma mark - 第一步，设置平台信息
//腾讯平台：APP ID ： 1105545815                        APP KEY  ： FB9fsUDgyV43ZrXg
#define SharePlatformQQ_APPID @"1105545815"
//微信平台：AppID:  wx9b5dcb8c9a3435e0                         key：f42348639479bcdd7abc011027c2c989
#define SharePlatformWeChat_APPID @"wx9b5dcb8c9a3435e0"

#define SharePlatformSina_APPID @"2032427802"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
#pragma mark - 第二部，在管理类中设置平台信息
    [ShareManager registerWithAppID:SharePlatformQQ_APPID andAppKey:nil WithPlatform:SharePlatformQQ];
    [ShareManager registerWithAppID:SharePlatformWeChat_APPID andAppKey:nil WithPlatform:SharePlatformWeChatFriend];
    [ShareManager registerWithAppID:SharePlatformSina_APPID andAppKey:nil WithPlatform:SharePlatformSina];
    return YES;
}
#pragma mark - 第三步，设置回调，如果不需要回调可以忽略掉
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
    //QQ、QQZone分享回调
    if ([url.absoluteString hasPrefix:@"tencent"]) {
        return [ShareManager handleOpenURL:url WithPlatform:SharePlatformQQ];
    }
    //微信分享回调
    if ([url.absoluteString hasPrefix:@"wx"]) {
        return [ShareManager handleOpenURL:url WithPlatform:SharePlatformWeChatFriend];
    }
    if ([url.absoluteString hasPrefix:@"wb"]) {
        return [ShareManager handleOpenURL:url WithPlatform:SharePlatformSina];
    }
    return YES;
}

@end
